#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>


int main()
{
	int n = 0, temp = 0, i = 0, sum = 0;
	scanf("%d", &n);
	sum = (n - 2) * 180;
	for (i = 0; i < n - 1; i++)
	{
		scanf("%d", &temp);
		sum -= temp;
	}
	printf("%d\n", sum);
	return 0;
}